package javaapplication3;
import java.io.*;
public class Try 
{
    private static final int PLUS  = 0;
    private static final int MINUS = 1;
    private static final int MULT  = 2;
    private static final int DIV = 3;
    private static final int POW  = 4;
    private static final int SKO  = 5;
    private static final int SKC  = 6;
    private static final int TG  = 7;
    private static final int SIN  = 8;
    private static final int COS  = 9;
    private static final int CTG  = 10;
    private static final int LG  = 11;
    private static final int ARCTG = 12;
    private static final int ARCCOS = 13;
    private static final int ARCCTG = 14;
    private static final int ARCSIN = 15;
    private static final int VAR  = 16;
    private static final int NUM  = 17;
    private static final int OPS_NUM = 18;
    private static final int L1 = 1;
    private static final int L2 = 2;
    private static final int L3 = 3;
    private static final int L4 = -1;
    private static final int EQ = 19;
    public static int stroka;
    public static double an [] [];
    private static final int c = -2;
    public static void main(String[] args) throws IOException
    {
        BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
        String str1 = reader.readLine();
        String str [] = str1.split("");
        String [] st = new String [OPS_NUM];
        st [PLUS] = "+";
        st [MINUS] = "-";
        st [MULT] = "*";
        st [DIV] = "/";
        st [POW] = "^";
        st [SIN] = "sin";
        st [COS] = "cos";
        st [TG] = "tg";
        st [CTG] = "ctg";
        st [ARCSIN] = "arcsin";
        st [ARCCOS] = "arccos";
        st [ARCTG] = "arctg";
        st [ARCCTG] = "arcctg";
        st [LG] = "lg";
        st [SKO] = "(";
        st [SKC] = ")";
        st [VAR] = "x";
        String [] stra = str1.split(" ");
        stroka  = stra.length;
        an = new double [3] [stra.length];
        for (int q = 0; q < stra.length; q++)
        {
            int w = 0;
            boolean e = false;
            while (w < OPS_NUM-1)
            {
                e = StringEquals (st [w], stra [q]);
                if (e == true)
                {
                    break;
                }
                w++;
            }
            if (w != OPS_NUM-1)
            {
                an [1] [q] = w;
                if (w == 0 || w == 1)
                {
                    an [2] [q] = 1;
                }
                if (w == 2 || w == 3)
                {
                    an [2] [q] = 2;
                }
                if (w < 3 && w >OPS_NUM-1)
                {
                    an [2] [q] = 3;
                }
                if (w == SKC)
                {
                    an [2] [q] = -1;
                }
            }
            else
            {
                an [0] [q] = Double.valueOf(stra [q]);
                an [1] [q] = NUM;
            }
        }
                double a = 0;
            
            INode l3 = new Const(3);
            INode l4 = new Var();
            INode l5 = new Const(5);
            INode l6 = new Const(6);
            
            INode s1 = new plus(l3, l4);
            INode s2 = new plus(l5, l6);
            INode s3 = new plus(s1, s2);
            
            
            double fun314 = s3.calc(3.14);
        
    }
    private static INode Calculator (int a, int b)
    {
        int len = b-a+2;
        int curr1 = 0;
        int curr2 = 0;
        INode [] res = new INode [len];
        double [] stak = new double [len];
        double [] arr1 = new double [len];
        INode m = new Var ();
        int q = a-1;
        int s = 0;
        int w = 0;
        int sko = 0;
        int skc = 0;
        while (q < b+1)
        {
            if (an [1] [q] == SKO || an [1] [q] == SKC)
            {
                if (an [1] [q] == SKO)
                {
                    sko = q;
                }
                else
                {
                    skc = q;
                    res [] Calculator (sko+2, skc+2);
                }
            }
            if (an [1] [q] == NUM || an [1] [q] == VAR)
            {
                if (an [1] [q] == NUM)
                {
                    res [w] = new Const (an [0] [q]);
                    w++;
                }
                else
                {
                    res [w] = new Var ();
                    w++;
                }
            }
            else
            {
                if (s == 0 || arr1 [s] < an [2] [q])
                {
                    stak [s] = an [1] [q];
                    arr1 [s] = an [2] [q];
                    s++;
                }
                else
                {
                    if (stak [s-1] <= 4)
                    {   
                        INode l1 = res [w-1];
                        INode l2 = res [w];
                        if (stak [s] == PLUS)
                        {
                            res [w-1] = new plus (l1, l2);
                        }
                        if (stak [s] == MINUS)
                        {
                            res [w-1] = new minus (l1, l2);
                        }
                        if (stak [s] == MULT)
                        {
                            res [w-1] = new mult (l1, l2);
                        }
                        if (stak [s] == DIV)
                        {
                            res [w-1] = new div (l1, l2);
                        }
                        if (stak [s] == POW)
                        {
                            res [w-1] = new pow (l1, l2);
                        }
                    }
                    else
                    {
                        INode s1 = res [w];
                        if (stak [s] == TG)
                        {
                            res [w] = new tang (s1);
                        }
                        if (stak [s] == SIN)
                        {
                            res [w] = new sin (s1);
                        }
                        if (stak [s] == COS)
                        {
                            res [w] = new cos (s1);
                        }
                        if (stak [s] == CTG)
                        {
                            res [w] = new ctang (s1);
                        }
                        if (stak [s] == LG)
                        {
                            res [w] = new lg (s1);
                        }
                        if (stak [s] == ARCSIN)
                        {
                            res [w] = new asin (s1);
                        }
                        if (stak [s] == ARCCOS)
                        {
                            res [w] = new acos (s1);
                        }
                        if (stak [s] == ARCTG)
                        {
                            res [w] = new atan (s1);
                        }
                        if (stak [s] == ARCCTG)
                        {
                            res [w] = new actg (s1);
                        }
                    }
                    
                        s--;
                        w--;
                }
            }
        }
    }
    
        private static boolean StringEquals (String str1,String str2)
    {
        boolean eq = false;
        char [] charr1 = str1.toCharArray();
        char [] charr2 = str2.toCharArray();
        int q = 0;
        int w = 0;
        if (charr2.length == charr1.length)
        {
            while (q < charr1.length)
            {
                if (charr1[q] == charr2 [q])
                {
                    w++;
                }
                q++;
            }
            if (w == charr1.length)
            {
                eq = true;
            }
        }
        return eq;
    }   
        private static interface INode
        {
            double calc(double x);
        }

        private static class Var implements INode
        {
            public double calc(double x){return x;}
        }
        private static class Const implements INode
        {
            public final double c;
            public Const(double cc)
            {
                c = cc;
            }
            
            public double calc(double x){return c;}
        }
        
        private static class plus implements INode
        {
            public final INode left;
            public final INode right;        
            public plus(INode l, INode r)
            {
                left = l;
                right = r;
            }
            
            public double calc(double x){return left.calc(x) + right.calc(x);}
        }
        private static class minus implements INode
        {
            public final INode left;
            public final INode right;        
            public minus(INode l, INode r)
            {
                left = l;
                right = r;
            }
            
            public double calc(double x){return left.calc(x) - right.calc(x);}
        }
        private static class mult implements INode
        {
            public final INode left;
            public final INode right;        
            public mult(INode l, INode r)
            {
                left = l;
                right = r;
            }
            
            public double calc(double x){return left.calc(x) * right.calc(x);}
        }
        private static class div implements INode
        {
            public final INode left;
            public final INode right;        
            public div(INode l, INode r)
            {
                left = l;
                right = r;
            }
            
            public double calc(double x){return left.calc(x)/right.calc(x);}
        }
        private static class pow implements INode
        {
            public final INode left;
            public final INode right;        
            public pow(INode l, INode r)
            {
                left = l;
                right = r;
            }
            
            public double calc(double x){return Math.pow(left.calc(x), right.calc(x));}
        }
        private static class sin implements INode
        {
            public final INode right;        
            public sin(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.sin(right.calc(x));}
        }
        private static class cos implements INode
        {
            public final INode right;        
            public cos(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.cos(right.calc(x));}
        }
        private static class tang implements INode
        {
            public final INode right;        
            public tang(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.tan(right.calc(x));}
        }
        private static class ctang implements INode
        {
            public final INode right;        
            public ctang(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return 1/Math.tan(right.calc(x));}
        }
        private static class acos implements INode
        {
            public final INode right;        
            public acos(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.acos(right.calc(x));}
        }
        private static class asin implements INode
        {
            public final INode right;        
            public asin(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.asin(right.calc(x));}
        }
        private static class atan implements INode
        {
            public final INode right;        
            public atan(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.atan(right.calc(x));}
        }
        private static class actg implements INode
        {
            public final INode right;        
            public actg(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return -Math.acos(right.calc(x))+Math.PI/2;}
        }
        private static class lg implements INode
        {
            public final INode right;        
            public lg(INode r)
            {
                right = r;
            }
            
            public double calc(double x){return Math.log(right.calc(x));}
        }
}